﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EasyGo.Domain.Model;
using EasyGo.Services;
using EasyGo.Web.Authentication;

namespace EasyGo.Web.Controllers
{
    public class TestController : Controller
    {
        private ICompanyService company;

        protected IAuthenticationService auth;

        public TestController(ICompanyService companyService, IAuthenticationService authService)
        {
            company = companyService;
            auth = authService;
        }


        public ActionResult CreateUser()
        {
            return this.View();
        }

        [HttpPost]
        public ActionResult CreateUser(UserAccount model)
        {
            if(ModelState.IsValid)
            {
                return Content(auth.CreateUser(model).ToString());
            }
            return this.View(model);
        }

        public ActionResult CreateCompany()
        {
            return this.View();
        }

        [HttpPost]
        public ActionResult CreateCompany(Company model)
        {
            if(ModelState.IsValid)
            {
                return this.Content(company.CreateCompany(model).ToString());
            }
            return this.View(model);
        }
    }
}
